<?php
/* @var $this ServiciosController */
/* @var $model servicios */



Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#servicios-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>


<!-- ________________________________ Muestra el mesaje de error de datos asociados ________________________________________-->
<div id="statusMsg">
<?php if(Yii::app()->user->getFlash('error')):?>
    <div class="flash-error">
        <?php echo Yii::app()->user->getFlash('error'); ?>
    </div>
<?php endif; ?>
</div>
<?php if (Yii::app()->user->hasFlash('success')): ?>
  <div class="alert alert-success">
    <?php echo Yii::app()->user->getFlash('success'); ?>
  </div>
<?php endif ?>
<?php if (Yii::app()->user->hasFlash('error')): ?>
  <div class="alert">
    <?php echo Yii::app()->user->getFlash('error'); ?>
  </div>
<?php endif ?>

<h1>Servicios</h1>


<!-- _________________________________________ Tooltip __________________________________________________________ -->
<?php
$this->widget('application.extensions.tipsy.Tipsy', array(
  'fade' => false,
  'gravity' => 'n',
  'items' => array(
    array('id' => '.tooltipster'),
    array('id' => '#tooltipster'),
    array('id' => array('model' => $model, 'attribute' => 'model_attribute_name')
     ,'fallback' => 'Put custom tooltip here.' ),    
  ),  
));
?>

<!-- _________________________________________ Botton de crer servicios __________________________________________ -->
<p align="right">
<?php //boton modal
$this->widget('bootstrap.widgets.TbButton', array(
       'label'=>'Agregar servicio',
       'type'=>'primary',
       'size'=>'medium',
       'url'=>array('servicios/create'),

   )); ?>
</p>



<!-- _________________________________________ Paginación __________________________________________________________-->

<div align="right">

<?php
    $this->widget('ext.PageSize.EPageSize', array(
    'gridViewId' => 'servicios-grid',
    'beforeLabel'=>'Registro por pantalla: ',
    'pageSize' => Yii::app()->request->getParam('pageSize',null),
    'defaultPageSize' =>  10 ,   // may use this :  Yii::app()->params['defaultPageSize'],
    'pageSizeOptions'=> array(5=>5, 10=>10, 25=>25, 50=>50, 75=>75, 100=>100), // you can config it in main.php under the config dir . Yii::app()->params['pageSizeOptions'],// Optional, you can use with the widget default
    ));
    ?>
 
 
<?php
$dataProvider = $model->search();
$pageSize = Yii::app()->user->getState('pageSize',10/*Yii::app()->params['defaultPageSize']*/);
$dataProvider->getPagination()->setPageSize($pageSize);
 
 ?>

</div>


<!-- _________________________________________ gridview _______________________________________________________________-->


<?php $this->widget('bootstrap.widgets.TbGridView', array(
	'type'=>'striped bordered condensed',
	'id'=>'servicios-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'template'=>"{summary}{items}{pager}",
	'itemsCssClass'=>'table table-striped table-bordered table-condensed tableNews',// mover por fila
    'enablePagination' => true,
	//'template'=>"{items}",
	//'htmlOptions'=>array('style'=>'word-wrap:break-word; width:1050px;'),
	'columns'=>array(
		array('name'=>'Se_idservicio_PK', 'header'=>'Código'),
		array('name'=>'Se_nombre', 'header'=>'Nombre'),
		array('name'=>'Se_ubicacion','header'=>'Ubicación'),
		
		
		array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'htmlOptions'=>array('style'=>'width: 50px'),
            'afterDelete'=>'function(link,success,data){ if(success) $("#statusMsg").html(data); }',
        ),
	),
)); ?>

